package com.baseweb.webadmin.core.constants;

import java.util.ArrayList;
import java.util.List;

public enum FeedBackDealType {
    KNOWLEDGE(-1, "未处理"), HELP(1, "已处理");

    private int code;
    private String name;

    FeedBackDealType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static List<FeedBackDealType> getAllData() {
        List<FeedBackDealType> result = new ArrayList<FeedBackDealType>();
        for (FeedBackDealType current : FeedBackDealType.values()) {
            result.add(current);
        }
        return result;
    }

    public static FeedBackDealType getNameByCode(int code) {
        List<FeedBackDealType> allData = getAllData();
        for (FeedBackDealType status : allData) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return null;
    }

    public static List<String> getTypeOpt() {
        List<String> list = new ArrayList<>();
        for (FeedBackDealType current : FeedBackDealType.values()) {
            String string = current.getCode() + ";" + current.getName();
            list.add(string);
        }
        return list;
    }
}
